import subprocess

from time import sleep
from turtledemo.penrose import start

from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy

from basic.basedriver import DRIVER
from basic.basepage import BasePage


class PageMain(BasePage):

    def goto_xiaomi_new_product(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="小米上新"]').click()
        from page.page_shopping.page_navigation_shopping_new import PageShoppingNew
        return PageShoppingNew()

    def goto_xiaomi_crowdfunding(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="小米众筹"]').click()
        sleep(2)

    def goto_classification(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="分类"]').click()
        sleep(2)

    def goto_mine(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="我的"]').click()
        sleep(2)

    def goto_service(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="服务"]').click()
        sleep(2)

    def goto_shopping_cart(self):
        self.driver.find_element(AppiumBy.XPATH,'//*[@text="购物车"]').click()
        sleep(2)

if __name__ == '__main__':
    PageMain().goto_xiaomi_new_product()
